#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main() {
    ifstream ifs;
    ifs.open("test.txt", ios::in);
    if (!ifs.is_open()) {
        cout << "文件打开失败" << endl;
    }
    //第一种读取方式
    /*
    char buf[1024] = {0};
    while(ifs >> buf){
        cout << buf << endl;
    }
    */

    //第二种读取方式
    /*
    char buf[1024] = {0};
    while(ifs.getline(buf, sizeof(buf))){
        cout << buf << endl;
    }
    */

    //第三种读取方式
    /*
    string buf;
    while (getline(ifs, buf)){
        cout << buf << endl;
    }  
    */

    


    ifs.close();
    return 0;
}